home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / terminal / qterm-6.0 / qterm-6 / bsdinst.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1993-07-28  |  1.6 KB  |  106 lines

  1. #!/bin/sh
  2. #
  3. # $Id: bsdinst.sh,v 6.0 1993/03/27 22:41:04 mcooper Exp mcooper $
  4. #
  5. # This accepts bsd-style install arguments and makes the appropriate calls
  6. # to the System V install.
  7. #
  8.  
  9. flags=""
  10. dst=""
  11. src=""
  12. dostrip=""
  13.  
  14. while [ x$1 != x ]; do
  15.     case $1 in 
  16.     -c) shift
  17.         continue;;
  18.  
  19.     -i) flags="$flags -idb $2 "
  20.         shift
  21.         shift
  22.         continue;;
  23.  
  24.     -[mg]) flags="$flags $1 $2 "
  25.         shift
  26.         shift
  27.         continue;;
  28.  
  29.     -o) shift
  30.         owner=$1
  31.         shift
  32.         continue;;
  33.  
  34.     -s) dostrip="strip"
  35.         shift
  36.         continue;;
  37.  
  38.     *)  if [ x$src = x ] 
  39.         then
  40.         src=$1
  41.         else
  42.         dst=$1
  43.         fi
  44.         shift
  45.         continue;;
  46.     esac
  47. done
  48.  
  49. if [ x$src = x ] 
  50. then
  51.     echo "bsdinstall:  no input file specified"
  52.     exit 1
  53. fi
  54.  
  55. if [ x$dst = x ] 
  56. then
  57.     echo "bsdinstall:  no destination specified"
  58.     exit 1
  59. fi
  60.  
  61.  
  62. # set up some variable to be used later
  63.  
  64. rmcmd=""
  65. srcdir="."
  66.  
  67. # if the destination isn't a directory we'll need to copy it first
  68.  
  69. if [ ! -d $dst ]
  70. then
  71.     dstbase=`basename $dst`
  72.     cp $src /tmp/$dstbase
  73.     rmcmd="rm -f /tmp/$dstbase"
  74.     src=$dstbase
  75.     srcdir=/tmp
  76.     dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`"
  77.     if [ x$dst = x ]
  78.     then
  79.         dst="."
  80.     fi
  81. fi
  82.  
  83.  
  84. # If the src file has a directory, copy it to /tmp to make install happy
  85.  
  86. srcbase=`basename $src`
  87.  
  88. if [ "$src" != "$srcbase" -a "$src" != "./$srcbase" ] 
  89. then
  90.     cp $src /tmp/$srcbase
  91.     src=$srcbase
  92.     srcdir=/tmp
  93.     rmcmd="rm -f /tmp/$srcbase"
  94. fi
  95.  
  96. # do the actual install (remove destination since SysV install doesn't)
  97.  
  98. rm -f $dst/$srcbase
  99. (cd $srcdir ; install -f $dst $flags $src; if [ -n "${owner}" ]; then chown $owner $src; fi)
  100.  
  101.  
  102. # and clean up
  103.  
  104. $rmcmd
  105.  
  106.